<?php

class Generator_Action_Cue extends Kernel_Action_Abstract 
{
    
    /**
     * Path to the template file.
     *
     * @var string
     */
    protected $_template = 'generator/cue.tpl';
    
    /**
     * Реализация обработки пользовательского запроса.
     *
     */
    protected function _process() 
    {
        $session_key = Application::getRequest()->get('session');
        
        if (!count($cue = $this->_model()->getValues($session_key))) {
            $this->_abort('Undefined seesion');
        }
        
        $this->_model()->log($session_key);
        
        Application::getResponse()->assign(array(
            'session_key' => $session_key, 
            'cue' => $cue, 
        ));
    }
    
    /**
    * Return model object
    * 
    * @return Generator_Model
    */
    protected function _model() 
    {
        static $cach;
        
        if (is_null($cach)) {
            $cach = new Generator_Model;
        }
        
        return $cach;
    }
    
}